package com.zzg.datastructure.binarysorttree;

import com.zzg.datastructure.binarysorttree.entity.Node;
import com.zzg.datastructure.binarysorttree.tree.BinarySortTree;

/**
 * @Author zhengzg
 * @Date 2022-09-30
 * @Version v1.0
 * 二叉排序树测试
 */
public class BinarySortTreeDemo {
    public static void main(String[] args) {
        int[] arr = {7, 3, 10, 12, 5, 1, 9,11,13};
        BinarySortTree binarySortTree = new BinarySortTree();
        //循环的添加结点到二叉排序树
        for (int value : arr) {
            binarySortTree.add(new Node(value));
        }

        // 中序遍历二叉树
        binarySortTree.infixOrder();

        binarySortTree.delNode(10);

        System.out.println("====================删除后==================");
        binarySortTree.infixOrder();
    }
}
